<template>
  <h1>个人简历练习</h1>
  <table border="1px">
    <tr>
      <td>照片:</td>
      <td><img :src="person.imgUrl" width="100"></td>
    </tr>
    <tr>
      <td>姓名:</td>
      <td>{{person.name}}</td>
    </tr>
    <tr>
      <td>年龄:</td>
      <td>{{person.age}}</td>
    </tr>
    <tr>
      <td>好友:</td>
      <td>
        <ul>
          <li v-for="friend in person.friends">{{friend}}</li>
        </ul>
      </td>
    </tr>
  </table>
  <button @click="f()">加载数据</button>
</template>

<script setup>
import {ref} from "vue";

const person = ref({name: '', age: '', imgUrl: '', friends: []});

const f = () => {
   person.value = {
    name:'传奇哥',
    age:20,
    friends:['路飞','索隆','娜美','张飞'],
    imgUrl:'fcq.jpg'
  };
}
</script>

<style scoped>

</style>